	// AsynList 异步列表
	var AsynList=function(selector){
		this.page=$("[name=page]").val();
		this.cache=$("#cache",this.selector).val();
		
		$(".container ul",this.selector).eq(0).append(this.cache);
	}
	AsynList.prototype=new Control();
	AsynList.prototype.cache="";
	AsynList.prototype.page=0;
	AsynList.prototype.init=function(){
		var self=this;
		$(".listMoreButton",this.selector).bind("click",function(event){
			self.load();
		})
		if(this.page==""){
			this.load();
		}else{
			this.updateMoreButton();
		}
	}
	AsynList.prototype.setItemTemplate=function(itemTemplate){
		this.itemTemplate=itemTemplate;
	}
	AsynList.prototype.load=function(){
		var page=$("[name=page]").val();
		if(page=="" || page==0){
			page=1;
		}else{
			page++;
		}
		$("[name=page]").val(page);

		var url=$(this.selector).attr("action");
		var method=$(this.selector).attr("method");
		var data=$(this.selector).serializeArray();
		var self=this;
		var options={}
		options.url=url
		options.dataType="json"
		options.cache=false
		options.type=method
		options.data=data
		options.success=function(data, textStatus, jqXHR){
			self.loadSuccess(data);
		},
		options.error=function(){
			alert("操作失败");
		}
		$.ajax(options);
	}
	AsynList.prototype.loadSuccess=function(data){
		var event=data.event;
		var tips=data.tips;

		if(event=="success"){
			var html=this.render(data.data);
		}
		if(event=="fail"){
			alert(tips);
		}
	}
	AsynList.prototype.updateMoreButton=function(){
		var more=$("#more").val();
		if(more==1){
			$(".listMoreButton",this.selector).addClass("enable");
		}else{
			$(".listMoreButton",this.selector).removeClass("enable");
			$(".listMoreButton",this.selector).unbind("click")
		}
	}
	AsynList.prototype.render=function(data){
		var page=parseInt(data.page)
		var totalPage=parseInt(data.totalPage)
		
		if(page<totalPage){
			$("#more").val(1);
		}else{
			$("#more").val(0);
		}
		this.updateMoreButton();
		$("[name=page]").val(page);

		var rows=data.rows
		var temp="";
		var row=null;
		var html="";
		var regExp=new RegExp();
		for(var i=0;i<rows.length;i++){
			row=rows[i];
			var temp=this.itemTemplate;
			for(var key in row){
				var value=row[key];

				regExp=new RegExp("\{"+key+"\}","g");
				temp=temp.replace(regExp,value);
			}
			html+=temp;
		}
		var cache=$("#cache",this.selector).val()+html;
		$("#cache",this.selector).val(cache);
		
		$(".container ul",this.selector).eq(0).append(html);
	}
	HTMLTurbo.control.AsynList=AsynList;